#include<stdio.h>
int FacSum(int n);
int main()
{
	int n;
	scanf("%d",&n);
	int ret = FacSum(n);
	printf("%d\n",ret);
	return 0;
}
int FacSum(int n)
{
	int sum = 0;
	int i = 0;
	for(i = 1;i<n;i++)
	{
		if(n % i == 0) {
			sum += i;
		}
	}
	return sum;
}

